/*
 * @Description: 全局 loading pinia 状态管理
 */
import { defineStore } from 'pinia';
import { ref } from 'vue';

export const LoadingStore = defineStore('loading', () => {
  /* 加载状态 */
  const loading = ref(false);
  
  /**
   * @description: 显示 loading
   */
  function show() {
    loading.value = true;
  }

  /**
   * @description: 隐藏 loading
   */
  function hide() {
    loading.value = false;
  }

  /* 导出函数、状态 */
  return {
    loading,
    show,
    hide,
  };
});
